﻿Imports QueComer

Public Class NuevaOfer

    Public GestionOfertas As GestionOfertas

    Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuardar.Click
        Dim negocio As New Gest_Ofer
        Dim wtf As New todo
        Dim desc = Me.nombrei.Text
        Dim fi = Me.tipo_comidai.Text
        Dim ff = Me.distritoi.Text
        

        ' Try
        'If lblId.Text <> "" Then
        'negocio.actualizar(desc, fi, ff, lblId.Text)
        'Else
        
        negocio.insertar(lblId.Text, desc, fi, ff)
        'End If

        Me.GestionOfertas.dgvplop.DataSource = ""

        Me.Close()
        ' Catch ex As Exception
        'lblMensaje.Text = "Hubo un error al guardar"
        'End Try

    End Sub

    Private Sub NuevaOfer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If lblId.Text <> "" Then
            Dim negocio As New Gest_Ofer
            Dim modelo = negocio.obtener(lblId.Text)
            nombrei.Text = modelo.descripcion
            tipo_comidai.Text = modelo.fecha_inicio
            distritoi.Text = modelo.fecha_fin

        Else

        End If



    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub
End Class